package net.confinanz.client.frontend;

import net.confinanz.client.controller.Controller;
import net.confinanz.config.ClientConfig;
import net.confinanz.connection.server.sql.Connector;

public class LoginThread extends Thread {
	
	private Login login;
	private Connector connector;
	private ClientConfig config;

	public LoginThread(Login login, Connector connector, ClientConfig config) {
		this.login = login;
		this.connector = connector;
		this.config = config;
		
		start();
	}
	
	@Override
	public void run() {
		try {
			this.connector.connect();
			new ConfinanzGui(new Controller(this.connector, this.config));
			this.login.loginSucceeded();
		} catch (Exception e) {
			this.login.loginFailed();
		}
	}
}
